package n14.second;

import java.util.stream.Stream;

public class S01 {

	public static void main(String[] args) {
		String saying="Practice makes perfect"; //熟能生巧
		String[]ss=saying.split(" "); //获得字符串数组
		System.out.println("利用forEach显示每个单词：");
		Stream.of(ss).map(s->s.toUpperCase()).forEach(System.out::println);
		System.out.println("利用map求每个单词的长度：");
		Stream.of(ss).map(s->s.length()).forEach(n->System.out.print(n+"\t"));
		System.out.println("\n长度大于5的单词为：");
		Stream.of(ss).filter(w->w.length()>5).forEach(n->System.out.print(n+"\t"));
		System.out.println("\n包含有字母a的单词有：");
		Stream.of(ss).filter(w->w.indexOf('a')>=0).forEach(n->System.out.print(n+"\t"));
		
	}

}
